import MyArtPlayer from "@/components/MyArtPlayer";
import FileApi, {FileObj} from "@/api/web/FileApi.ts";
import React from "react";
import {ViewProcessor} from "@/components/FilePreviewProcess/processors/_index.ts";

const _main = ({fileObj}: { fileObj: FileObj }) => {
    return <MyArtPlayer
        getInstance={(art) => {
            art.type = 'ts'
            art.switchUrl(FileApi.getM3U8Link(fileObj.path))
        }}
    />
}

export default class TsVideoView extends ViewProcessor {
    protected uniKey: string = "TsVideoView";

    getName = () => {
        return "ts视频"
    }

    ViewFunctionComponent = () => <_main fileObj={this.fileObj}/>

    isViewAble = () => {
        return this.fileObj.type.startsWith("ts")
    }
}
